package com.gopay.common.domain.cbrmb;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.domain.BaseEntity;

/**
 * 
 * @ClassName: CbBankAcct
 * @Description: TODO(客户境外银行账户表)
 * @author huangcheng
 * @date 2016年7月1日 下午4:18:06
 */
@Entity
@Table(name = "CB_BANK_ACCT")
public class CbBankAcct extends BaseEntity {

    private static final long serialVersionUID = 3928151240115526820L;

    /**
     * 编号
     */
    private Long cbBankAcctSq;

    /**
     * 客户ID
     */
    private String custId;

    /**
     * 账户类型 100-客户账户 200-跨境汇款收款人账户 300-留学汇款人账户
     */
    private String acctType;

    /**
     * 收款人姓名
     */
    private String receiverName;

    /**
     * 收款人账号
     */
    private String receiverAccount;

    /**
     * 收款人地址
     */
    private String receiverAddress;

    /**
     * 常驻国家/地区
     */
    private String receiverCountry;

    /**
     * 收款人开户银行名称
     */
    private String receiverBankName;

    /**
     * 收款人开户银行地址
     */
    private String receiverBankAddress;

    /**
     * SWIFT CODE
     */
    private String receiverSwiftCode;

    /**
     * BANK_CODE
     */
    private String receiverBankCode;

    /**
     * 代理行名称
     */
    private String correspBankName;

    /**
     * 代理行地址
     */
    private String correspBankAddress;

    /**
     * 代理行SWIFT CODE
     */
    private String correspSwiftCode;

    /**
     * 代理行BANK_CODE
     */
    private String correspBankCode;

    /**
     * 在其代理行账号
     */
    private String correspBankAccount;

    /**
     * 人行行号
     */
    private String pbocCode;

    /**
     * 是否为默认收款账户 0-默认账户 1-普通账户
     */
    private String isdefault;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 记录最后修改时间
     */
    private Date updateTime;

    /**
     * 删除标志 0-未删除 1-已删除
     */
    private String delFlag;

    @Id
    @SequenceGenerator(name = "CbBankAcctSeq", sequenceName = "CB_BANK_ACCT_SEQ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CbBankAcctSeq")
    @Column(name = "CB_BANK_ACCT_SQ", unique = true, nullable = false)
    public Long getCbBankAcctSq() {
        return this.cbBankAcctSq;
    }

    public void setCbBankAcctSq(Long cbBankAcctSq) {
        this.cbBankAcctSq = cbBankAcctSq;
    }

    @Column(name = "CUST_ID", length = 30)
    public String getCustId() {
        return this.custId;
    }

    public void setCustId(String custId) {
        this.custId = custId;
    }

    @Column(name = "ACCT_TYPE", length = 3)
    public String getAcctType() {
        return this.acctType;
    }

    public void setAcctType(String acctType) {
        this.acctType = acctType;
    }

    @Column(name = "RECEIVER_NAME", length = 300)
    public String getReceiverName() {
        // edit by huangcheng 2016年11月17日15:50:54 PCI认证修改
        this.receiverName = SensitiveInfoUtils.autoReencrypt(this.receiverName);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.receiverName);
    }

    public void setReceiverName(String receiverName) {
        // edit by huangcheng 2016年11月17日15:50:54 PCI认证修改
        this.receiverName = SensitiveInfoUtils.smartEncryptWithCheck(receiverName);
    }

    @Column(name = "RECEIVER_ACCOUNT", length = 150)
    public String getReceiverAccount() {
        // edit by huangcheng 2016年11月17日15:50:54 PCI认证修改
        this.receiverAccount = SensitiveInfoUtils.autoReencrypt(this.receiverAccount);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.receiverAccount);
    }

    public void setReceiverAccount(String receiverAccount) {
        this.receiverAccount = SensitiveInfoUtils.smartEncryptWithCheck(receiverAccount);
    }

    @Column(name = "RECEIVER_ADDRESS", length = 200)
    public String getReceiverAddress() {
        return this.receiverAddress;
    }

    public void setReceiverAddress(String receiverAddress) {
        this.receiverAddress = receiverAddress;
    }

    @Column(name = "RECEIVER_COUNTRY", length = 100)
    public String getReceiverCountry() {
        return this.receiverCountry;
    }

    public void setReceiverCountry(String receiverCountry) {
        this.receiverCountry = receiverCountry;
    }

    @Column(name = "RECEIVER_BANK_NAME", length = 100)
    public String getReceiverBankName() {
        return this.receiverBankName;
    }

    public void setReceiverBankName(String receiverBankName) {
        this.receiverBankName = receiverBankName;
    }

    @Column(name = "RECEIVER_BANK_ADDRESS", length = 200)
    public String getReceiverBankAddress() {
        return this.receiverBankAddress;
    }

    public void setReceiverBankAddress(String receiverBankAddress) {
        this.receiverBankAddress = receiverBankAddress;
    }

    @Column(name = "RECEIVER_SWIFT_CODE", length = 50)
    public String getReceiverSwiftCode() {
        return this.receiverSwiftCode;
    }

    public void setReceiverSwiftCode(String receiverSwiftCode) {
        this.receiverSwiftCode = receiverSwiftCode;
    }

    @Column(name = "RECEIVER_BANK_CODE", length = 50)
    public String getReceiverBankCode() {
        return this.receiverBankCode;
    }

    public void setReceiverBankCode(String receiverBankCode) {
        this.receiverBankCode = receiverBankCode;
    }

    @Column(name = "CORRESP_BANK_NAME", length = 100)
    public String getCorrespBankName() {
        return this.correspBankName;
    }

    public void setCorrespBankName(String correspBankName) {
        this.correspBankName = correspBankName;
    }

    @Column(name = "CORRESP_BANK_ADDRESS", length = 200)
    public String getCorrespBankAddress() {
        return this.correspBankAddress;
    }

    public void setCorrespBankAddress(String correspBankAddress) {
        this.correspBankAddress = correspBankAddress;
    }

    @Column(name = "CORRESP_SWIFT_CODE", length = 50)
    public String getCorrespSwiftCode() {
        return this.correspSwiftCode;
    }

    public void setCorrespSwiftCode(String correspSwiftCode) {
        this.correspSwiftCode = correspSwiftCode;
    }

    @Column(name = "CORRESP_BANK_CODE", length = 50)
    public String getCorrespBankCode() {
        return this.correspBankCode;
    }

    public void setCorrespBankCode(String correspBankCode) {
        this.correspBankCode = correspBankCode;
    }

    @Column(name = "CORRESP_BANK_ACCOUNT", length = 150)
    public String getCorrespBankAccount() {
        this.correspBankAccount = SensitiveInfoUtils.autoReencrypt(this.correspBankAccount);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.correspBankAccount);
    }

    public void setCorrespBankAccount(String correspBankAccount) {
        this.correspBankAccount = SensitiveInfoUtils.smartEncryptWithCheck(correspBankAccount);
    }

    @Column(name = "PBOC_CODE", length = 20)
    public String getPbocCode() {
        return this.pbocCode;
    }

    public void setPbocCode(String pbocCode) {
        this.pbocCode = pbocCode;
    }

    @Column(name = "ISDEFAULT", length = 1)
    public String getIsdefault() {
        return this.isdefault;
    }

    public void setIsdefault(String isdefault) {
        this.isdefault = isdefault;
    }

    @Column(name = "CREATE_TIME")
    public Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Column(name = "UPDATE_TIME")
    public Date getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Column(name = "DEL_FLAG", length = 1)
    public String getDelFlag() {
        return this.delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    @Override
    public boolean equals(Object wobj) {
        if ((this == wobj)) {
            return true;
        }
        if ((wobj == null)) {
            return false;
        }
        if (!(wobj instanceof CbBankAcct)) {
            return false;
        }
        CbBankAcct other = (CbBankAcct) wobj;
        if (((null == this.custId && null == other.getCustId())
                || (null != this.custId && this.custId.equals(other.getCustId())))
                && ((null == this.acctType && null == getAcctType())
                        || (null != this.acctType && this.acctType.equals(other.getAcctType())))
                && ((null == this.receiverName && null == getReceiverName())
                        || (null != this.getReceiverName() && this.getReceiverName().equals(other.getReceiverName())))
                && ((null == this.receiverAccount && null == getReceiverAccount())
                        || (null != this.getReceiverAccount() && this.getReceiverAccount().equals(other.getReceiverAccount())))
                && ((null == this.receiverCountry && null == getReceiverCountry())
                        || (null != this.receiverCountry && this.receiverCountry.equals(other.getReceiverCountry())))
                && ((null == this.receiverBankName && null == getReceiverBankName())
                        || (null != this.receiverBankName && this.receiverBankName.equals(other.getReceiverBankName())))
                && ((null == this.receiverSwiftCode && null == getReceiverSwiftCode())
                        || (null != this.receiverSwiftCode
                                && this.receiverSwiftCode.equals(other.getReceiverSwiftCode())))
                && ((null == this.pbocCode && null == getPbocCode())
                        || (null != this.pbocCode && this.pbocCode.equals(other.getPbocCode())))) {
            return true;
        }
        return false;
    }

}
